/*
 * rfid_tag.hpp
 *
 *  Created on: May 11, 2011
 *      Author: jmurray
 */

#ifndef RFID_TAG_HPP_
#define RFID_TAG_HPP_

#include <string>
#include <vector>
#include <iostream>

#include "block.hpp"
class Block;
class RFID_tag;

//! Tag status predefines
#define TAG_FREE 		1
#define TAG_SOFT_LOCK 	2
#define TAG_HARD_LOCK 	3
#define TAG_OCCUPIED 	4

/*!
* This Enumeration helps to keep track of all the positions that the track might fall into. 
* By default an ID tag is along a straight piece of track, and thus there 
* is no turn out to worry about. If there IS a turn out, then this 
* enumeration will help sort out which direction the tag is 
* approaching the physical switch from. The Right, Left and Center options
* are used to indicate the track DIVERGING. The ExitRight, ExitLeft, and 
* ExitCenter options indicate that the next tag is CONVERGING. Use of this
* system will allow trains to navigate by switches by backing up once they
* have passed them. 
*/
enum track
{
	Straight,
	Right,
	Left,
	Center,
	ExitRight,
	ExitLeft,
	ExitCenter
};
	
typedef struct {
	//!Link to the connecting tag
	RFID_tag* link;

	//! Distance to the tag in mm. 
	int distance;

	//! Indicator of this being a signal tag that can be used as a holding spot. Note that this means that heading in this direction, the signal is a stop. The NEXT signal (the on that this link points too) may not be a safe stopping point. See its own links if needed. 
	bool stop;
	
	//! This elenemt should be based off of the track enumeration. 
	int track;

}RFID_link;

using namespace std;

class RFID_tag {
public:
	RFID_tag();
	virtual ~RFID_tag();
	
	//Helpful functions
	void print();

	//! Unique ID which identifies this Tag
	int ID;

	//! Human Readable name of this RFID Tag
	string name;

	//!ASCI String of the Tag
	string tagName;

	//! Status of the Tag
	char status;

	//! Maximum speed of the Tag
	int maxSpeed;
	
	//! Links to adajecent tags. 
	vector<RFID_link> linkMap;
};

#endif /* RFID_TAG_HPP_ */
